package com.lul15834.orderfood.activity.manager;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.lul15834.orderfood.R;
import com.lul15834.orderfood.activity.manager.adapter.CommentListAdapter;
import com.lul15834.orderfood.bean.CommentBean;
import com.lul15834.orderfood.dao.CommentDao;
import com.lul15834.orderfood.until.Tools;

import java.util.List;

//评论内容
public class Comment extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_comment);
        Toolbar toolbar=findViewById(R.id.comment_back);
        toolbar.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(Comment.this,Manager.class);
                intent.putExtra("sta","1");
                startActivity(intent);
            }
        });
        ListView listView=findViewById(R.id.comment_listView);
        String account= Tools.getOnAccount(this);
        List<CommentBean> list= CommentDao.getCommentByBusiness(account);
        //适配器
        CommentListAdapter commentListAdapter=new CommentListAdapter(this,list);
        if (list==null||list.size()==0){
            listView.setAdapter(null);
        }else {
            listView.setAdapter(commentListAdapter);
        }

    }
}